﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity.ModelConfiguration;
using CarErp.Model;

namespace CarErp.Data.Mappings
{
	public class CarPurchaseApprovalPaperMapping : EntityTypeConfiguration<CarPurchaseApprovalPaper>
	{
		public CarPurchaseApprovalPaperMapping()
		{
			this.Id(x => x.Id);
			this.Text(x => x.Comment, 800);
			Property(x => x.ApprovalTime).IsRequired();

			HasRequired(x => x.Approver)
				.WithMany()
				.WillCascadeOnDelete();

			HasRequired(x => x.Application)
				.WithOptional(x => x.ApprovalPaper)
				.Map(m=>m.MapKey("Application_Id"))
				.WillCascadeOnDelete();
		}
	}
}
